package com.wt.order.common;

/**
 * @author 吴涛
 * @date 2022/5/10 19:56
 * @qq 337144203
 * 基于ThreadLocal封装工具类，用户保存和获取当前登录用户id
 */
public class BaseContext {
    private static ThreadLocal<Long> threadLocal = new ThreadLocal<>();

    public static void setCurrentId(Long id){
        threadLocal.set(id);
    }


    public static Long getCurrentId(){
   return threadLocal.get();
    }

    //最后要给他释放掉
    public static void removeCurrentId(Long id){
        threadLocal.remove();
    }

}
